home *** CD-ROM | disk | FTP | other *** search
/ Meeting Pearls 1 / Meeting Pearls Vol 1 (1994).iso / installed_progs / text / faqs / uucp-internals < prev    next >
Encoding:
Internet Message Format  |  1994-05-18  |  63.6 KB

  1. Subject: UUCP Internals Frequently Asked Questions
  2. Newsgroups: comp.mail.uucp,comp.answers,news.answers
  3. From: ian@airs.com (Ian Lance Taylor)
  4. Date: 16 May 94 08:30:03 GMT
  5.  
  6. Archive-name: uucp-internals
  7. Version: $Revision: 1.23 $
  8. Last-modified: $Date: 1994/01/23 04:36:38 $
  9.  
  10.  This article was written by Ian Lance Taylor <ian@airs.com> and I may
  11.  even update it periodically.  Please send me mail about suggestions
  12.  or inaccuracies.
  13.  
  14.  This article describes how the various UUCP protocols work, and
  15.  discusses some other internal UUCP issues.  It does not describe how
  16.  to configure UUCP, nor how to solve UUCP connection problems, nor how
  17.  to deal with UUCP mail.  There are currently no FAQ postings on any
  18.  of these topics, and I do not plan to write any.
  19.  
  20.  If you haven't read the news.announce.newusers articles, read them.
  21.  
  22.  This article is in digest format.  Some newsreaders will be able to
  23.  break it apart into separate articles.  Please don't ask me how to do
  24.  this, though.
  25.  
  26.  This article answers the following questions.  If one of these
  27.  questions is posted to comp.mail.uucp, please send mail to the poster
  28.  referring her or him to this FAQ.  There is no reason to post a
  29.  followup, as most of us know the answer already.
  30.  
  31. Sources
  32. What does "alarm" mean in debugging output?
  33. What are UUCP grades?
  34. What is the format of a UUCP lock file?
  35. What is the format of a UUCP X.* file?
  36. What is the UUCP protocol?
  37. What is the 'g' protocol?
  38. What is the 'f' protocol?
  39. What is the 't' protocol?
  40. What is the 'e' protocol?
  41. What is the 'G' protocol?
  42. What is the 'i' protocol?
  43. What is the 'x' protocol?
  44. What is the 'd' protocol?
  45. What is the 'h' protocol?
  46. What is the 'v' protocol?
  47. Thanks
  48.  
  49. ----------------------------------------------------------------------
  50.  
  51. From: Sources
  52. Subject: Sources
  53.  
  54. I took a lot of the information from Jamie E. Hanrahan's paper in the
  55. Fall 1990 DECUS Symposium, and from Managing UUCP and Usenet by Tim
  56. O'Reilly and Grace Todino (with contributions by several other
  57. people).  The latter includes most of the former, and is published by
  58.         O'Reilly & Associates, Inc.
  59.         103 Morris Street, Suite A
  60.         Sebastopol, CA 95472
  61. It is currently in its tenth edition.  The ISBN number is
  62. 0-937175-93-5.
  63.  
  64. Some information is originally due to a Usenet article by Chuck
  65. Wegrzyn.  The information on execution files comes partially from
  66. Peter Honeyman.  The information on the 'g' protocol comes partially
  67. from a paper by G.L. Chesson of Bell Laboratories, partially from
  68. Jamie E. Hanrahan's paper, and partially from source code by John
  69. Gilmore.  The information on the 'f' protocol comes from the source
  70. code by Piet Berteema.  The information on the 't' protocol comes from
  71. the source code by Rick Adams.  The information on the 'e' protocol
  72. comes from a Usenet article by Matthias Urlichs.  The information on
  73. the 'd' protocol comes from Jonathan Clark, who also supplied
  74. information about QFT.  The FSUUCP information comes straight from
  75. Christopher J. Ambler; it applies to version 1.4 and up.
  76.  
  77. Although there are few books about UUCP, there are many about networks
  78. and protocols in general.  I recommend two non-technical books which
  79. describe the sorts of things that are available on the network: ``The
  80. Whole Internet,'' by Ed Krol, and ``Zen and the Art of the Internet,''
  81. by Brendan P. Kehoe.  Good technical discussions of networking issues
  82. can be found in ``Internetworking with TCP/IP,'' by Douglas E. Comer
  83. and David L. Stevens and in ``Design and Validation of Computer
  84. Protocols'' by Gerard J. Holzmann.
  85.  
  86. ------------------------------
  87.  
  88. From: alarm
  89. Subject: What does "alarm" mean in debugging output?
  90.  
  91. The debugging output of many versions of UUCP (but not Taylor UUCP)
  92. will include messages like
  93.     alarm 1
  94. or
  95.     pkcget: alarm 1
  96.  
  97. This message means that the UUCP package has timed out while waiting
  98. for some sort of response from the remote system.  This normally
  99. indicates some sort of connection problem.  For example, the modems
  100. might have lost their connection, or perhaps one of the modems will
  101. not transmit the XON and XOFF characters, or perhaps one side or the
  102. other is dropping characters.  It can also mean that the packages
  103. disagree about some aspect of the UUCP protocol, although this is less
  104. common.
  105.  
  106. Using the information in the rest of this posting, you should be able
  107. to figure out what type of data your UUCP was expecting to receive.
  108. This may give some indication as to exactly what the problem is.  It
  109. is difficult to be more specific, since there are many possiblities.
  110.  
  111. ------------------------------
  112.  
  113. From: UUCP-grades
  114. Subject: What are UUCP grades?
  115.  
  116. Modern UUCP packages support grades for each command.  The grades
  117. generally range from 'A' (the highest) to 'Z' followed by 'a' to 'z'.
  118. Some UUCP packages also support '0' to '9' before 'A'.  Some UUCP
  119. packages may permit any ASCII character as a grade.
  120.  
  121. On Unix, these grades are encoded in the name of the command file.  A
  122. command file name generally has the form
  123.     C.nnnngssss
  124. where nnnn is the remote system name for which the command is queued,
  125. g is a single character grade, and ssss is a four character sequence
  126. number.  For example, a command file created for the system ``airs''
  127. at grade 'Z' might be named
  128.     C.airsZ2551
  129.  
  130. The remote system name will be truncated to seven characters, to
  131. ensure that the command file name will fit in the 14 character file
  132. name limit of the traditional Unix file system.  UUCP packages which
  133. have no other means of distinguishing which command files are intended
  134. for which systems thus require all systems they connect to to have
  135. names that are unique in the first seven characters.  Some UUCP
  136. packages use a variant of this format which truncates the system name
  137. to six characters.  HDB and Taylor UUCP use a different spool
  138. directory format, which allows up to fourteen characters to be used
  139. for each system name.
  140.  
  141. The sequence number in the command file name may be a decimal integer,
  142. or it may be a hexadecimal integer, or it may contain any alphanumeric
  143. character.  Different UUCP packages are different.
  144.  
  145. FSUUCP (a DOS based UUCP and news package) uses up to 8 characters for
  146. file names in the spool (this is a DOS file name limitation; actually,
  147. with the extension, 11 characters are available, but FSUUCP reserves
  148. that for future use).  FSUUCP defaults mail to grade D, and news to
  149. grade N, except that when the grade of incoming mail can be
  150. determined, that grade is preserved if the mail is forwarded to
  151. another system.  Mail and news are currently the only 2 types of
  152. transfers supported.  The default grades may be changed by editing
  153. the MAIL.RC file for mail, or the FSUUCP.CFG file for news.
  154.  
  155. UUPC/extended for DOS, OS/2 and Windows NT handles mail at grade 'C',
  156. news at grade 'd', and file transfers at grade 'n'.  The UUPC/extended
  157. UUCP and RMAIL commands accept grades to override the default, the
  158. others do not.
  159.  
  160. I do not know how command grades are handled in other non-Unix UUCP
  161. packages.
  162.  
  163. Modern UUCP packages allow you to restrict file transfer by grade
  164. depending on the time of day.  Typically this is done with a line in
  165. the Systems (or L.sys) file like this:
  166.     airs Any/Z,Any2305-0855 ...
  167. This allows grades 'Z' and above to be transferred at any time.  Lower
  168. grades may only be transferred at night.  I believe that this grade
  169. restriction applies to local commands as well as to remote commands,
  170. but I am not sure.  It may only apply if the UUCP package places the
  171. call, not if it is called by the remote system.
  172.  
  173. Taylor UUCP can use the ``timegrade'' and ``call-timegrade'' commands
  174. to achieve the same effect (and supports the above format when reading
  175. Systems or L.sys).
  176.  
  177. UUPC/extended provides the symmetricgrades option to announce the
  178. current grade in effect when calling the remote system.
  179.  
  180. This sort of grade restriction is most useful if you know what grades
  181. are being used at the remote site.  The default grades used depend on
  182. the UUCP package.  Generally uucp and uux have different defaults.  A
  183. particular grade can be specified with the -g option to uucp or uux.
  184. For example, to request execution of rnews on airs with grade 'd', you
  185. might use something like
  186.     uux -gd - airs!rnews <article
  187.  
  188. Uunet queues up mail at grade 'C', but increases the grade based on
  189. the size.  News is queued at grade 'd', and file transfers at grade
  190. 'n'.  The example above would allow mail (below some large size) to be
  191. received at any time, but would only permit news to be transferred at
  192. night.
  193.  
  194. ------------------------------
  195.  
  196. From: UUCP-lock-file
  197. Subject: What is the format of a UUCP lock file?
  198.  
  199. This discussion applies only to Unix.  I have no idea how UUCP locks
  200. ports on other systems.
  201.  
  202. UUCP creates files to lock serial ports and systems.  On most if not
  203. all systems these same lock files are also used by cu to coordinate
  204. access to serial ports.  On some systems getty also uses these lock
  205. files, often under the name uugetty.
  206.  
  207. The lock file normally contains the process ID of the locking process.
  208. This makes it easy to determine whether a lock is still valid.  The
  209. algorithm is to create a temporary file and then link it to the name
  210. that must be locked.  If the link fails because a file with that name
  211. already exists, the existing file is read to get the process ID.  If
  212. the process still exists, the lock attempt fails.  Otherwise the lock
  213. file is deleted and the locking algorithm is retried.
  214.  
  215. Older UUCP packages put the lock files in the main UUCP spool
  216. directory, /usr/spool/uucp.  HDB UUCP generally puts the lock files in
  217. a directory of their own, usually /usr/spool/locks or /etc/locks.
  218.  
  219. The original UUCP lock file format encodes the process ID as a four
  220. byte binary number.  The order of the bytes is host-dependent.  HDB
  221. UUCP stores the process ID as a ten byte ASCII decimal number, with a
  222. trailing newline.  For example, if process 1570 holds a lock file, it
  223. would contain the eleven characters space, space, space, space, space,
  224. space, one, five, seven, zero, newline.  Some versions of UUCP add a
  225. second line indicating which program created the lock (uucp, cu, or
  226. getty/uugetty).  I have also seen a third type of UUCP lock file which
  227. does not contain the process ID at all.
  228.  
  229. The name of the lock file is traditionally "LCK.." followed by the
  230. base name of the device.  For example, to lock /dev/ttyd0 the file
  231. LCK..ttyd0 would be created.  On SCO Unix, the lock file name is
  232. always forced to lower case even if the device name has upper case
  233. letters.
  234.  
  235. System V Release 4 UUCP names the lock file using the major and minor
  236. device numbers rather than the device name.  The file is named
  237. LK.XXX.YYY.ZZZ, where XXX, YYY and ZZZ are all three digit decimal
  238. numbers.  XXX is the major device number of the device holding the
  239. directory holding the device file (e.g., /dev).  YYY is the major
  240. device number of the device file itself.  ZZZ is the minor device
  241. number of the device file itself.  If s holds the result of passing
  242. the device to the stat system call (e.g., stat ("/dev/ttyd0", &s)),
  243. the following line of C code will print out the corresponding lock
  244. file name:
  245.     printf ("LK.%03d.%03d.%03d", major (s.st_dev),
  246.             major (s.st_rdev), minor (s.st_rdev));
  247. The advantage of this system is that even if there are several links
  248. to the same device, they will all use the same lock file name.
  249.  
  250. ------------------------------
  251.  
  252. From: X-file
  253. Subject: What is the format of a UUCP X.* file?
  254.  
  255. UUCP X.* files control program execution.  They are created by uux.
  256. They are transferred between computers just like any other file.  The
  257. uuxqt daemon reads them to figure out how to execute the job requested
  258. by uux.
  259.  
  260. An X.* file is simply a text file.  The first character of each line
  261. is a command, and the remainder of the line supplies arguments.  The
  262. following commands are defined:
  263.     C command
  264.         This gives the command to execute, including the program and
  265.         all arguments.  For example,
  266.             C rmail ian@airs.com
  267.     U user system
  268.         This names the user who requested the command, and the system
  269.         from which the request came.
  270.     I standard-input
  271.         This names the file from which standard input is taken.  If no
  272.         standard input file is given, the standard input will probably
  273.         be attached to /dev/null.  If the standard input file is not
  274.         from the system on which the execution is to occur, it will
  275.         also appear in an F command.
  276.     O standard-output [ system ]
  277.         This names the standard output file.  The optional second
  278.         argument names the system to which the file should be sent.
  279.         If there is no second argument, the file should be created on
  280.         the executing system.
  281.     F required-file [ filename-to-use ]
  282.         The F command can appear multiple times.  Each F command names
  283.         a file which must exist before the execution can proceed.
  284.         This will usually be a file which is transferred from the
  285.         system on which uux was executed, but it can also be a file
  286.         from the local system or some other system.  If the file is
  287.         not from the local system, then the command will usually name
  288.         a file in the spool directory.  If the optional second
  289.         argument appears, then the file should be copied to the
  290.         execution directory under that name.  This is necessary for
  291.         any file other than the standard input file.  If the standard
  292.         input file is not from the local system, it will appear in
  293.         both an F command and an I command.
  294.     R requestor-address
  295.         This is the address to which mail about the job should be
  296.         sent.  It is relative to the system named in the U command.
  297.         If the R command does not appear, then mail is sent to the
  298.         user named in the U command.
  299.     Z
  300.         This command takes no arguments.  It means that a mail message
  301.         should be sent if the command failed.  This is the default
  302.         behaviour for most modern UUCP packages, and for them the Z
  303.         command does not actually do anything.
  304.     N
  305.         This command takes no arguments.  It means that no mail
  306.         message should be sent, even if the command failed.
  307.     n
  308.         This command takes no arguments.  It means that a mail message
  309.         should be sent if the command succeeded.  Normally a message
  310.         is sent only if the command failed.
  311.     B
  312.         This command takes no arguments.  It means that the standard
  313.         input should be returned with any error message.  This can be
  314.         useful in cases where the input would otherwise be lost.
  315.     e
  316.         This command takes no arguments.  It means that the command
  317.         should be processed with /bin/sh.  For some packages this is
  318.         the default anyhow.  Most packages will refuse to execute
  319.         complex commands or commands containing wildcards, because of
  320.         the security holes this opens.
  321.     E
  322.         This command takes no arguments.  It means that the command
  323.         should be processed with the execve system call.  For some
  324.         packages this is the default anyhow.
  325.     M status-file
  326.         This command means that instead of mailing a message, the
  327.         message should be copied to the named file on the system named
  328.         by the U command.
  329.     # comment
  330.         This command is ignored, as is any other unrecognized command.  
  331.  
  332. Here is an example.  Given the following command executed on system
  333. test1
  334.     uux - test2!cat - test2!~ian/bar !qux '>~/gorp'
  335. (this is only an example, as most UUCP systems will not permit the cat
  336. command to be executed) Taylor UUCP will produce the following X.
  337. file:
  338.     U ian test1
  339.     F D.test1N003r qux
  340.     O /usr/spool/uucppublic test1
  341.     F D.test1N003s
  342.     I D.test1N003s
  343.     C cat - ~ian/bar qux
  344. The standard input will be read into a file and then transferred to
  345. the file D.test1N003s on system test2, and the file qux will be
  346. transferred to D.test1N003r on system test2.  When the command is
  347. executed, the latter file will be copied to the execution directory
  348. under the name qux.  Note that since the file ~ian/bar is already on
  349. the execution system, no action need be taken for it.  The standard
  350. output will be collected in a file, then copied to the directory
  351. /usr/spool/uucppublic on the system test1.
  352.  
  353. ------------------------------
  354.  
  355. From: UUCP-protocol
  356. Subject: What is the UUCP protocol?
  357.  
  358. The UUCP protocol is a conversation between two UUCP packages.  A UUCP
  359. conversation consists of three parts: an initial handshake, a series
  360. of file transfer requests, and a final handshake.
  361.  
  362. Before the initial handshake, the caller will usually have logged in
  363. the called machine and somehow started the UUCP package there.  On
  364. Unix this is normally done by setting the shell of the login name used
  365. to /usr/lib/uucp/uucico.
  366.  
  367. All messages in the initial handshake begin with a ^P (a byte with the
  368. octal value \020) and end with a null byte (\000).  A few systems end
  369. these messages with a line feed character (\012) instead of a null
  370. byte; the examples below assume a null byte is being used.
  371.  
  372. Some options below are supported by QFT, which stands for Queued File
  373. Transfer, and is (or was) an internal Bell Labs version of UUCP.  
  374.  
  375. Taylor UUCP size negotiation was introduced by Taylor UUCP, and is
  376. also supported by DOS based FSUUCP and Amiga based wUUCP and
  377. UUCP-1.17.
  378.  
  379. The initial handshake goes as follows.  It is begun by the called
  380. machine.
  381.  
  382. called: \020Shere=hostname\000
  383.     The hostname is the UUCP name of the called machine.  Older UUCP
  384.     packages do not output it, and simply send \020Shere\000.
  385.  
  386. caller: \020Shostname options\000
  387.     The hostname is the UUCP name of the calling machine.  The
  388.     following options may appear (or there may be none):
  389.         -QSEQ
  390.             Report sequence number for this conversation.  The
  391.             sequence number is stored at both sites, and incremented
  392.             after each call.  If there is a sequence number mismatch,
  393.             something has gone wrong (somebody may have broken
  394.             security by pretending to be one of the machines) and the
  395.             call is denied.  If the sequence number changes on one of
  396.             the machines, perhaps because of an attempted breakin or
  397.             because a disk backup was restored, the sequence numbers
  398.             on the two machines must be reconciled manually.  This is
  399.             not supported by FSUUCP.
  400.         -xLEVEL
  401.             Requests the called system to set its debugging level to
  402.             the specified value.  This is not supported by all
  403.             systems.
  404.         -pGRADE
  405.         -vgrade=GRADE
  406.             Requests the called system to only transfer files of the
  407.             specified grade or higher.  This is not supported by all
  408.             systems.  Some systems support -p, some support -vgrade=.
  409.         -R
  410.             Indicates that the calling UUCP understands how to restart
  411.             failed file transmissions.  Supported only by System V
  412.             Release 4 UUCP and QFT.
  413.         -ULIMIT
  414.             Reports the ulimit value of the calling UUCP.  The limit
  415.             is specified as a base 16 number in C notation (e.g.,
  416.             -U0x1000000).  This number is the number of 512 byte
  417.             blocks in the largest file which the calling UUCP can
  418.             create.  The called UUCP may not transfer a file larger
  419.             than this.  Supported only by System V Release 4 UUCP, QFT
  420.             and FSUUCP.  FSUUCP reports the lesser of the
  421.             available disk space on the spool directory drive and the
  422.             ulimit variable in FSUUCP.CFG.
  423.         -N
  424.             Indicates that the calling UUCP understands the Taylor
  425.             UUCP size negotiation extension.  Not supported by
  426.         traditional UUCP packages.
  427.  
  428. called: \020ROK\000
  429.     There are actually several possible responses.
  430.         ROK
  431.             The calling UUCP is acceptable, and the handshake proceeds
  432.             to the protocol negotiation.  Some options may also
  433.             appear; see below.
  434.         ROKN
  435.             The calling UUCP is acceptable, it specified -N, and the
  436.             called UUCP also understands the Taylor UUCP size limiting
  437.             extensions.
  438.         RLCK
  439.             The called UUCP already has a lock for the calling UUCP,
  440.             which normally indicates the two machines are already
  441.             communicating.
  442.         RCB
  443.             The called UUCP will call back.  This may be used to avoid
  444.             impostors (but only one machine out of each pair should
  445.             call back, or no conversation will ever begin).
  446.         RBADSEQ
  447.             The call sequence number is wrong (see the -Q discussion
  448.             above). 
  449.         RLOGIN
  450.             The calling UUCP is using the wrong login name.
  451.         RYou are unknown to me
  452.             The calling UUCP is not known to the called UUCP, and the
  453.             called UUCP does not permit connections from unknown
  454.             systems.  Some versions of UUCP just drop the line rather
  455.             than sending this message.
  456.  
  457.     If the response is ROK, the following options are supported by
  458.     System V Release 4 UUCP and QFT.
  459.         -R
  460.             The called UUCP knows how to restart failed file
  461.             transmissions.
  462.         -ULIMIT
  463.             Reports the ulimit value of the called UUCP.  The limit is
  464.             specified as a base 16 number in C notation.  This number
  465.             is the number of 512 byte blocks in the largest file which
  466.             the called UUCP can create.  The calling UUCP may not send
  467.             a file larger than this.  Also supported by FSUUCP.
  468.         -xLEVEL
  469.             I'm not sure just what this means.  It may request the
  470.             calling UUCP to set its debugging level to the specified
  471.             value.
  472.     If the response is not ROK (or ROKN) both sides hang up the phone,
  473.     abandoning the call.
  474.  
  475. called: \020Pprotocols\000
  476.     Note that the called UUCP outputs two strings in a row.  The
  477.     protocols string is a list of UUCP protocols supported by the
  478.     caller.  Each UUCP protocol has a single character name.  These
  479.     protocols are discussed in more detail later in this document.
  480.     For example, the called UUCP might send \020Pgf\000.
  481.  
  482. caller: \020Uprotocol\000
  483.     The calling UUCP selects which protocol to use out of the
  484.     protocols offered by the called UUCP.  If there are no mutually
  485.     supported protocols, the calling UUCP sends \020UN\000 and both
  486.     sides hang up the phone.  Otherwise the calling UUCP sends
  487.     something like \020Ug\000.
  488.  
  489. Most UUCP packages will consider each locally supported protocol in
  490. turn and select the first one supported by the called UUCP.  With some
  491. versions of HDB UUCP, this can be modified by giving a list of
  492. protocols after the device name in the Devices file or the Systems
  493. file.  For example, to select the 'e' protocol in Systems,
  494.     airs Any ACU,e ...
  495. or in Devices,
  496.     ACU,e ttyXX ...
  497. Taylor UUCP provides the ``protocol'' command which may be used either
  498. for a system or a port.
  499.  
  500. After the protocol has been selected and the initial handshake has been
  501. completed, both sides turn on the selected protocol.  For some
  502. protocols (notably 'g') a further handshake is done at this point.
  503.  
  504. Each protocol supports a method for sending a command to the remote
  505. system.  This method is used to transmit a series of commands between
  506. the two UUCP packages.  At all times, one package is the master and
  507. the other is the slave.  Initially, the calling UUCP is the master.
  508.  
  509. If a protocol error occurs during the exchange of commands, both sides
  510. move immediately to the final handshake.
  511.  
  512. The master will send one of four commands: S, R, X or H.
  513.  
  514. Any file name referred to below is either an absolute pathname
  515. beginning with "/", a public directory pathname beginning with "~/", a
  516. pathname relative to a user's home directory beginning with "~USER/",
  517. or a spool directory file name.  File names in the spool directory are
  518. not pathnames, but instead are converted to pathnames within the spool
  519. directory by UUCP.  They always begin with "C." (for a command file
  520. created by uucp or uux), "D." (for a data file created by uucp, uux or
  521. by an execution, or received from another system for an execution), or
  522. "X." (for an execution file created by uux or received from another
  523. system).
  524.  
  525. master: S FROM TO USER -OPTIONS TEMP MODE NOTIFY SIZE
  526.     The S and the - are literal characters.  This is a request by the
  527.     master to send a file to the slave.
  528.         FROM
  529.             The name of the file to send.  If the C option does not
  530.             appear in OPTIONS, the master will actually open and send
  531.             this file.  Otherwise the file has been copied to the
  532.             spool directory, where it is named TEMP.  The slave
  533.             ignores this field unless TO is a directory, in which case
  534.             the basename of FROM will be used as the file name.  If
  535.             FROM is a spool directory filename, it must be a data file
  536.             created for or by an execution, and must begin with "D.".
  537.         TO
  538.             The name to give the file on the slave.  If this field
  539.             names a directory the file is placed within that directory
  540.             with the basename of FROM.  A name ending in `/' is taken
  541.             to be a directory even if one does not already exist with
  542.             that name.  If TO begins with `X.', an execution file will
  543.             be created on the slave.  Otherwise, if TO begins with
  544.             `D.' it names a data file to be used by some execution
  545.             file.  Otherwise, TO should not be in the spool directory.
  546.         USER
  547.             The name of the user who requested the transfer.
  548.         OPTIONS
  549.             A list of options to control the transfer.  The following
  550.             options are defined (all options are single characters):
  551.                 C
  552.                     The file has been copied to the spool directory
  553.                     (the master should use TEMP rather than FROM).
  554.                 c
  555.                     The file has not been copied to the spool
  556.                     directory (this is the default).
  557.                 d
  558.                     The slave should create directories as necessary
  559.                     (this is the default).
  560.                 f
  561.                     The slave should not create directories if
  562.                     necessary, but should fail the transfer instead.
  563.                 m
  564.                     The master should send mail to USER when the
  565.                     transfer is complete (not supported by FSUUCP).
  566.                 n
  567.                     The slave should send mail to NOTIFY when the
  568.                     transfer is complete (not supported by FSUUCP).
  569.         TEMP
  570.             If the C option appears in OPTIONS, this names the file to
  571.             be sent.  Otherwise if FROM is in the spool directory,
  572.             TEMP is the same as FROM.  Otherwise TEMP may be a dummy
  573.             string, such as "D.0".  After the transfer has been
  574.             succesfully completed, the master will delete the file
  575.             TEMP.
  576.         MODE
  577.             This is an octal number giving the mode of the file on
  578.             MASTER.  If the file is not in the spool directory, the
  579.             slave will always create it with mode 0666, except that if
  580.             (MODE & 0111) is not zero (the file is executable), the
  581.             slave will create the file with mode 0777.  If the file is
  582.             in the spool directory, some UUCP packages will use the
  583.             algorithm above and some will always create the file with
  584.             mode 0600.  This field is not used by FSUUCP, since it is
  585.             meaningless on DOS.
  586.         NOTIFY
  587.             This field may not be present, and in any case is only
  588.             meaningful if the n option appears in OPTIONS.  If the n
  589.             option appears, then when the transfer is successfully
  590.             completed, the slave will send mail to NOTIFY, which must
  591.             be a legal mailing address on the slave.  If a SIZE field
  592.             will appear but the n option does not appear, NOTIFY will
  593.             always be present, typically as the string "dummy" or
  594.             simply a pair of double quotes.
  595.         SIZE
  596.             This field is only present when doing Taylor UUCP or SVR4
  597.             UUCP size negotiation, It is the size of the file in
  598.             bytes.  Taylor UUCP version 1.03 sends the size as a
  599.             decimal integer, while versions 1.04 and up, and all other
  600.             UUCP packages that support size negotiation, send the size
  601.             in base 16 with a leading 0x.
  602.  
  603.     The slave then responds with an S command response.
  604.         SY START
  605.             The slave is willing to accept the file, and file transfer
  606.             begins.  The START field will only be present when using
  607.             file restart.  It specifies the byte offset into the file
  608.             at which to start sending.  If this is a new file, START
  609.             will be 0x0.
  610.         SN2
  611.             The slave denies permission to transfer the file.  This
  612.             can mean that the destination directory may not be
  613.             accessed, or that no requests are permitted.  It implies
  614.             that the file transfer will never succeed.
  615.         SN4
  616.             The slave is unable to create the necessary temporary
  617.             file.  This implies that the file transfer might succeed
  618.             later.
  619.         SN6
  620.             This is only used by Taylor UUCP size negotiation.  It
  621.             means that the slave considers the file too large to
  622.             transfer at the moment, but it may be possible to transfer
  623.             it at some other time.
  624.         SN7
  625.             This is only used by Taylor UUCP size negotiation.  It
  626.             means that the slave considers the file too large to ever
  627.             transfer.
  628.         SN8
  629.             This is only used by Taylor UUCP.  It means that the file
  630.             was already received in a previous conversation.  This can
  631.             happen if the receive acknowledgement was lost after it
  632.             was sent by the receiver but before it was received by the
  633.             sender.
  634.     SN9
  635.         This is only used by Taylor UUCP (versions 1.05 and up)
  636.         and FSUUCP (versions 1.5 and up).  It means that the
  637.         remote system was unable to open another channel (see the
  638.         discussion of the 'i' protocol for more information about
  639.         channels).  This implies that the file transfer might
  640.         succeed later.
  641.  
  642.     If the slave responds with SY, a file transfer begins.  When the
  643.     file transfer is complete, the slave sends a C command response.
  644.         CY
  645.             The file transfer was successful.
  646.         CYM
  647.             The file transfer was successful, and the slave wishes to
  648.             become the master; the master should send an H command,
  649.             described below.
  650.         CN5
  651.             The temporary file could not be moved into the final
  652.             location.  This implies that the file transfer will never
  653.             succeed.
  654.  
  655.     After the C command response has been received (in the SY case) or
  656.     immediately (in an SN case) the master will send another command.
  657.  
  658. master: R FROM TO USER -OPTIONS SIZE
  659.     The R and the - are literal characters.  This is a request by the
  660.     master to receive a file from the slave.  I do not know how SVR4
  661.     UUCP or QFT implement file transfer restart in this case.
  662.         FROM
  663.             This is the name of the file on the slave which the master
  664.             wishes to receive.  It must not be in the spool directory,
  665.             and it may not contain any wildcards.
  666.         TO
  667.             This is the name of the file to create on the master.  I
  668.             do not believe that it can be a directory.  It may only be
  669.             in the spool directory if this file is being requested to
  670.             support an execution either on the master or on some
  671.             system other than the slave.
  672.         USER
  673.             The name of the user who requested the transfer.
  674.         OPTIONS
  675.             A list of options to control the transfer.  The following
  676.             options are defined (all options are single characters):
  677.                 d
  678.                     The master should create directories as necessary
  679.                     (this is the default).
  680.                 f
  681.                     The master should not create directories if
  682.                     necessary, but should fail the transfer instead.
  683.                 m
  684.                     The master should send mail to USER when the
  685.                     transfer is complete.
  686.         SIZE
  687.             This only appears if Taylor UUCP size negotiation is being
  688.             used.  It specifies the largest file which the master is
  689.             prepared to accept (when using SVR4 UUCP or QFT, this was
  690.             specified in the -U option during the initial handshake).
  691.  
  692.     The slave then responds with an R command response.  FSUUCP does
  693.     not support R requests, and always responds with RN2.
  694.         RY MODE [ SIZE ]
  695.             The slave is willing to send the file, and file transfer
  696.             begins.  MODE is the octal mode of the file on the slave.
  697.             The master treats this just as the slave does the MODE
  698.             argument in the send command, q.v.  I am told that SVR4
  699.             UUCP sends a trailing SIZE argument.  For some versions of
  700.             BSD UUCP, the MODE argument may have a trailing M
  701.             character (e.g., RY 0666M).  This means that the slave
  702.             wishes to become the master.
  703.         RN2
  704.             The slave is not willing to send the file, either because
  705.             it is not permitted or because the file does not exist.
  706.             This implies that the file request will never succeed.
  707.         RN6
  708.             This is only used by Taylor UUCP size negotiation.  It
  709.             means that the file is too large to send, either because
  710.             of the size limit specifies by the master or because the
  711.             slave considers it too large.  The file transfer might
  712.             succeed later, or it might not (this will be cleared up in
  713.             a later release of Taylor UUCP).
  714.     RN9
  715.         This is only used by Taylor UUCP (versions 1.05 and up)
  716.         and FSUUCP (versions 1.5 and up).  It means that the
  717.         remote system was unable to open another channel (see the
  718.         discussion of the 'i' protocol for more information about
  719.         channels).  This implies that the file transfer might
  720.         succeed later.
  721.  
  722.     If the slave responds with RY, a file transfer begins.  When the
  723.     file transfer is complete, the master sends a C command.  The
  724.     slave pretty much ignores this, although it may log it.
  725.         CY
  726.             The file transfer was successful.
  727.         CN5
  728.             The temporary file could not be moved into the final
  729.             location.
  730.  
  731.     After the C command response has been sent (in the RY case) or
  732.     immediately (in an RN case) the master will send another command.
  733.  
  734. master: X FROM TO USER -OPTIONS
  735.     The X and the - are literal characters.  This is a request by the
  736.     master to, in essence, execute uucp on the slave.  The slave
  737.     should execute "uucp FROM TO".
  738.         FROM
  739.             This is the name of the file or files on the slave which
  740.             the master wishes to transfer.  Any wildcards are expanded
  741.             on the slave.  If the master is requesting that the files
  742.             be transferred to itself, the request would normally
  743.             contain wildcard characters, since otherwise an `R'
  744.             command would suffice.  The master can also use this
  745.             command to request that the slave transfer files to a
  746.             third system.
  747.         TO
  748.             This is the name of the file or directory to which the
  749.             files should be transferred.  This will normally use a
  750.             UUCP name.  For example, if the master wishes to receive
  751.             the files itself, it would use "master!path".
  752.         USER
  753.             The name of the user who requested the transfer.
  754.         OPTIONS
  755.             A list of options to control the transfer.  It is not
  756.             clear which, if any, options are supported by most UUCP
  757.             packages.
  758.  
  759.     The slave then responds with an X command response.  FSUUCP does
  760.     not support X requests, and always responds with XN.
  761.         XY
  762.             The request was accepted, and the appropriate file
  763.             transfer commands have been queued up for later
  764.             processing.
  765.         XN
  766.             The request was denied.  No particular reason is given.
  767.  
  768.     In either case, the master will then send another command.
  769.  
  770. master: H
  771.     This is used by the master to hang up the connection.  The slave
  772.     will respond with an H command response.
  773.         HY
  774.             The slave agrees to hang up the connection.  In this case
  775.             the master sends another HY command.  In some UUCP
  776.             packages the slave will then send a third HY command.  At
  777.             this point the protocol is shut down, and the final
  778.             handshake is begun.
  779.         HN
  780.             The slave does not agree to hang up.  In this case the
  781.             master and the slave exchange roles.  The next command
  782.             will be sent by the former slave, which is the new master.
  783.             The roles may be reversed several times during a single
  784.             connection.
  785.  
  786. After the protocol has been shut down, the final handshake is
  787. performed.  This handshake has no real purpose, and some UUCP packages
  788. simply drop the connection rather than do it (in fact, some will drop
  789. the connection immediately after both sides agree to hangup, without
  790. even closing down the protocol).
  791.  
  792. caller: \020OOOOOO\000
  793. called: \020OOOOOOO\000
  794.  
  795. That is, the calling UUCP sends six O's and the called UUCP replies
  796. with seven O's.  Some UUCP packages always send six O's.
  797.  
  798. ------------------------------
  799.  
  800. From: UUCP-g
  801. Subject: What is the 'g' protocol?
  802.  
  803. The 'g' protocol is a packet based flow controlled error correcting
  804. protocol that requires an eight bit clear connection.  It is the
  805. original UUCP protocol, and is supported by all UUCP implementations.
  806. Many implementations of it are only able to support small window and
  807. packet sizes, specifically a window size of 3 and a packet size of 64
  808. bytes, but the protocol itself can support up to a window size of 7
  809. and a packet size of 4096 bytes.  Complaints about the inefficiency of
  810. the 'g' protocol generally refer to specific implementations, rather
  811. than to the correctly implemented protocol.
  812.  
  813. The 'g' protocol was originally designed for general packet drivers,
  814. and thus contains some features that are not used by UUCP, including
  815. an alternate data channel and the ability to renegotiate packet and
  816. window sizes during the communication session.
  817.  
  818. The 'g' protocol is spoofed by many Telebit modems.  When spoofing is
  819. in effect, each Telebit modem uses the 'g' protocol to communicate
  820. with the attached computer, but the data between the modems is sent
  821. using a Telebit proprietary error correcting protocol.  This allows
  822. for very high throughput over the Telebit connection, which, because
  823. it is half-duplex, would not normally be able to handle the 'g'
  824. protocol very well at all.  When a Telebit is spoofing the 'g'
  825. protocol, it forces the packet size to be 64 bytes and the window size
  826. to be 3.
  827.  
  828. This discussion of the 'g' protocol explains how it works, but does
  829. not discuss useful error handling techniques.  Some discussion of this
  830. can be found in Jamie E. Hanrahan's paper, cited above.
  831.  
  832. All 'g' protocol communication is done with packets.  Each packet
  833. begins with a six byte header.  Control packets consist only of the
  834. header.  Data packets contain additional data.
  835.  
  836. The header is as follows:
  837.  
  838.     \020
  839.         Every packet begins with a ^P.
  840.     k (1 <= k <= 9)
  841.         The k value is always 9 for a control packet.  For a data
  842.         packet, the k value indicates how much data follows the six
  843.         byte header.  The amount of data is 2 ** (k + 4), where **
  844.         indicates exponentiation.  Thus a k value of 1 means 32 data
  845.         bytes and a k value of 8 means 4096 data bytes.  The k value
  846.         for a data packet must be between 1 and 8 inclusive.
  847.     checksum low byte
  848.     checksum high byte
  849.         The checksum value is described below.
  850.     control byte
  851.         The control byte indicates the type of packet, and is
  852.         described below.
  853.     xor byte
  854.         This byte is the xor of k, the checksum low byte, the checksum
  855.         high byte and the control byte (i.e., the second, third,
  856.         fourth and fifth header bytes).  It is used to ensure that the
  857.         header data is valid.
  858.  
  859. The control byte in the header is composed of three bit fields,
  860. referred to here as TT (two bits), XXX (three bits) and YYY (three
  861. bits).  The control is TTXXXYYY, or (TT << 6) + (XXX << 3) + YYY.
  862.  
  863. The TT field takes on the following values:
  864.     0
  865.         This is a control packet.  In this case the k byte in the
  866.         header must be 9.  The XXX field indicates the type of control
  867.         packet; these types are described below.
  868.     1
  869.         This is an alternate data channel packet.  This is not used by
  870.         UUCP.
  871.     2
  872.         This is a data packet, and the entire contents of the attached
  873.         data field (whose length is given by the k byte in the header)
  874.         are valid.  The XXX and YYY fields are described below.
  875.     3
  876.         This is a short data packet.  Let the length of the data field
  877.         (as given by the k byte in the header) be L.  Let the first
  878.         byte in the data field be B1.  If B1 is less than 128 (if the
  879.         most significant bit of B1 is 0), then there are L - B1 valid
  880.         bytes of data in the data field, beginning with the second
  881.         byte.  If B1 >= 128, let B2 be the second byte in the data
  882.         field.  Then there are L - ((B1 & 0x7f) + (B2 << 7)) valid
  883.         bytes of data in the data field, beginning with the third
  884.         byte.  In all cases L bytes of data are sent (and all data
  885.         bytes participate in the checksum calculation) but some of the
  886.         trailing bytes may be dropped by the receiver.   The XXX and
  887.         YYY fields are described below.
  888.  
  889. In a data packet (short or not) the XXX field gives the sequence
  890. number of the packet.  Thus sequence numbers can range from 0 to 7,
  891. inclusive.  The YYY field gives the sequence number of the last
  892. correctly received packet.
  893.  
  894. Each communication direction uses a window which indicates how many
  895. unacknowledged packets may be transmitted before waiting for an
  896. acknowledgement.  The window may range from 1 to 7, and may be
  897. different in each direction. For example, if the window is 3 and the
  898. last packet acknowledged was packet number 6, packet numbers 7, 0 and
  899. 1 may be sent but the sender must wait for an acknowledgement before
  900. sending packet number 2.  This acknowledgement could come as the YYY
  901. field of a data packet or as the YYY field of a RJ or RR control
  902. packet (described below).
  903.  
  904. Each packet must be transmitted in order (the sender may not skip
  905. sequence numbers).  Each packet must be acknowledged, and each packet
  906. must be acknowledged in order.
  907.  
  908. In a control packet, the XXX field takes on the following values:
  909.     1 CLOSE
  910.         The connection should be closed immediately.  This is
  911.         typically sent when one side has seen too many errors and
  912.         wants to give up.  It is also sent when shutting down the
  913.         protocol.  If an unexpected CLOSE packet is received, a CLOSE
  914.         packet should be sent in reply and the 'g' protocol should
  915.         halt, causing UUCP to enter the final handshake.
  916.     2 RJ or NAK
  917.         The last packet was not received correctly.  The YYY field
  918.         contains the sequence number of the last correctly received
  919.         packet.
  920.     3 SRJ
  921.         Selective reject.  The YYY field contains the sequence number
  922.         of a packet that was not received correctly, and should be
  923.         retransmitted.  This is not used by UUCP, and most
  924.         implementations will not recognize it.
  925.     4 RR or ACK
  926.         Packet acknowledgement.  The YYY field contains the sequence
  927.         number of the last correctly received packet.
  928.     5 INITC
  929.         Third initialization packet.  The YYY field contains the
  930.         maximum window size to use.
  931.     6 INITB
  932.         Second initialization packet.  The YYY field contains the
  933.         packet size to use.  It requests a size of 2 ** (YYY + 5).
  934.         Note that this is not the same coding used for the k byte in
  935.         the packet header (it is 1 less).  Most UUCP implementations
  936.         that request a packet size larger than 64 bytes can handle any
  937.         packet size up to that specified.
  938.     7 INITA
  939.         First initialization packet.  The YYY field contains the
  940.         maximum window size to use.
  941.  
  942. The checksum of a control packet is simply 0xaaaa - the control byte.
  943.  
  944. The checksum of a data packet is 0xaaaa - (CHECK ^ the control byte),
  945. where ^ denotes exclusive or, and CHECK is the result of the following
  946. routine as run on the contents of the data field (every byte in the
  947. data field participates in the checksum, even for a short data
  948. packet).  Below is the routine used by Taylor UUCP; it is a slightly
  949. modified version of a routine which John Gilmore patched from G.L.
  950. Chesson's original paper.  The z argument points to the data and the c
  951. argument indicates how much data there is.
  952.  
  953. int
  954. igchecksum (z, c)
  955.      register const char *z;
  956.      register int c;
  957. {
  958.   register unsigned int ichk1, ichk2;
  959.  
  960.   ichk1 = 0xffff;
  961.   ichk2 = 0;
  962.  
  963.   do
  964.     {
  965.       register unsigned int b;
  966.  
  967.       /* Rotate ichk1 left.  */
  968.       if ((ichk1 & 0x8000) == 0)
  969.         ichk1 <<= 1;
  970.       else
  971.         {
  972.           ichk1 <<= 1;
  973.           ++ichk1;
  974.         }
  975.  
  976.       /* Add the next character to ichk1.  */
  977.       b = *z++ & 0xff;
  978.       ichk1 += b;
  979.  
  980.       /* Add ichk1 xor the character position in the buffer counting from
  981.          the back to ichk2.  */
  982.       ichk2 += ichk1 ^ c;
  983.  
  984.       /* If the character was zero, or adding it to ichk1 caused an
  985.          overflow, xor ichk2 to ichk1.  */
  986.       if (b == 0 || (ichk1 & 0xffff) < b)
  987.         ichk1 ^= ichk2;
  988.     }
  989.   while (--c > 0);
  990.  
  991.   return ichk1 & 0xffff;
  992. }
  993.  
  994. When the 'g' protocol is started, the calling UUCP sends an INITA
  995. control packet with the window size it wishes the called UUCP to use.
  996. The called UUCP responds with an INITA packet with the window size it
  997. wishes the calling UUCP to use.  Pairs of INITB and INITC packets are
  998. then similarly exchanged.  When these exchanges are completed, the
  999. protocol is considered to have been started.
  1000.  
  1001. Note that the window and packet sizes are not a negotiation.  Each
  1002. system announces the window and packet size which the other system
  1003. should use.  It is possible that different window and packet sizes
  1004. will be used in each direction.  The protocol works this way on the
  1005. theory that each system knows how much data it can accept without
  1006. getting overrun.  Therefore, each system tells the other how much data
  1007. to send before waiting for an acknowledgement.
  1008.  
  1009. When a UUCP package transmits a command, it sends one or more data
  1010. packets.  All the data packets will normally be complete, although
  1011. some UUCP packages may send the last one as a short packet.  The
  1012. command string is sent with a trailing null byte, to let the receiving
  1013. package know when the command is finished.  Some UUCP packages require
  1014. the last byte of the last packet sent to be null, even if the command
  1015. ends earlier in the packet.  Some packages may require all the
  1016. trailing bytes in the last packet to be null, but I have not confirmed
  1017. this.
  1018.  
  1019. When a UUCP package sends a file, it will send a sequence of data
  1020. packets.  The end of the file is signalled by a short data packet
  1021. containing zero valid bytes (it will normally be preceeded by a short
  1022. data packet containing the last few bytes in the file).
  1023.  
  1024. Note that the sequence numbers cover the entire communication session,
  1025. including both command and file data.
  1026.  
  1027. When the protocol is shut down, each UUCP package sends a CLOSE
  1028. control packet.
  1029.  
  1030. ------------------------------
  1031.  
  1032. From: UUCP-f
  1033. Subject: What is the 'f' protocol?
  1034.  
  1035. The 'f' protocol is a seven bit protocol which checksums an entire
  1036. file at a time.  It only uses the characters between \040 and \176
  1037. (ASCII space and ~) inclusive as well as the carriage return
  1038. character.  It can be very efficient for transferring text only data,
  1039. but it is very inefficient at transferring eight bit data (such as
  1040. compressed news).  It is not flow controlled, and the checksum is
  1041. fairly insecure over large files, so using it over a serial connection
  1042. requires handshaking (XON/XOFF can be used) and error correcting
  1043. modems.  Some people think it should not be used even under those
  1044. circumstances.
  1045.  
  1046. I believe the 'f' protocol originated in BSD versions of UUCP.  It was
  1047. originally intended for transmission over X.25 PAD links.
  1048.  
  1049. The 'f' protocol has no startup or finish protocol.  However, both
  1050. sides typically sleep for a couple of seconds before starting up,
  1051. because they switch the terminal into XON/XOFF mode and want to allow
  1052. the changes to settle before beginning transmission.
  1053.  
  1054. When a UUCP package transmits a command, it simply sends a string
  1055. terminated by a carriage return.
  1056.  
  1057. When a UUCP package transmits a file, each byte b of the file is
  1058. translated according to the following table:
  1059.  
  1060.        0 <= b <=  037: 0172, b + 0100 (0100 to 0137)
  1061.      040 <= b <= 0171:       b        ( 040 to 0171)
  1062.     0172 <= b <= 0177: 0173, b - 0100 ( 072 to  077)
  1063.     0200 <= b <= 0237: 0174, b - 0100 (0100 to 0137)
  1064.     0240 <= b <= 0371: 0175, b - 0200 ( 040 to 0171)
  1065.     0372 <= b <= 0377: 0176, b - 0300 ( 072 to  077)
  1066.  
  1067. That is, a byte between \040 and \171 inclusive is transmitted as is,
  1068. and all other bytes are prefixed and modified as shown.
  1069.  
  1070. When all the file data is sent, a seven byte sequence is sent: two
  1071. bytes of \176 followed by four ASCII bytes of the checksum as printed
  1072. in base 16 followed by a carriage return.  For example, if the
  1073. checksum was 0x1234, this would be sent: "\176\1761234\r".
  1074.  
  1075. The checksum is initialized to 0xffff.  For each byte that is sent it
  1076. is modified as follows (where b is the byte before it has been
  1077. transformed as described above):
  1078.  
  1079.       /* Rotate the checksum left.  */
  1080.       if ((ichk & 0x8000) == 0)
  1081.         ichk <<= 1;
  1082.       else
  1083.         {
  1084.           ichk <<= 1;
  1085.           ++ichk;
  1086.         }
  1087.  
  1088.       /* Add the next byte into the checksum.  */
  1089.       ichk += b;
  1090.  
  1091. When the receiving UUCP sees the checksum, it compares it against its
  1092. own calculated checksum and replies with a single character followed
  1093. by a carriage return.
  1094.     G
  1095.         The file was received correctly.
  1096.     R
  1097.         The checksum did not match, and the file should be resent from
  1098.         the beginning.
  1099.     Q
  1100.         The checksum did not match, but too many retries have occurred
  1101.         and the communication session should be abandoned.
  1102.  
  1103. The sending UUCP checks the returned character and acts accordingly.
  1104.  
  1105. ------------------------------
  1106.  
  1107. From: UUCP-t
  1108. Subject: What is the 't' protocol?
  1109.  
  1110. The 't' protocol is intended for use on links which provide reliable
  1111. end-to-end connections, such as TCP.  It does no error checking or
  1112. flow control, and requires an eight bit clear channel.
  1113.  
  1114. I believe the 't' protocol originated in BSD versions of UUCP.
  1115.  
  1116. When a UUCP package transmits a command, it first gets the length of
  1117. the command string, C.  It then sends ((C / 512) + 1) * 512 bytes (the
  1118. smallest multiple of 512 which can hold C bytes plus a null byte)
  1119. consisting of the command string itself followed by trailing null
  1120. bytes.
  1121.  
  1122. When a UUCP package sends a file, it sends it in blocks.  Each block
  1123. contains at most 1024 bytes of data.  Each block consists of four
  1124. bytes containing the amount of data in binary (most significant byte
  1125. first, the same format as used by the Unix function htonl) followed by
  1126. that amount of data.  The end of the file is signalled by a block
  1127. containing zero bytes of data.
  1128.  
  1129. ------------------------------
  1130.  
  1131. From: UUCP-e
  1132. Subject: What is the 'e' protocol?
  1133.  
  1134. The 'e' protocol is similar to the 't' protocol.  It does no flow
  1135. control or error checking and is intended for use over networks
  1136. providing reliable end-to-end connections, such as TCP.
  1137.  
  1138. The 'e' protocol originated in versions of HDB UUCP.
  1139.  
  1140. When a UUCP package transmits a command, it simply sends the command
  1141. as an ASCII string terminated by a null byte.
  1142.  
  1143. When a UUCP package transmits a file, it sends the complete size of
  1144. the file as an ASCII decimal number.  The ASCII string is padded out
  1145. to 20 bytes with null bytes (i.e. if the file is 1000 bytes long, it
  1146. sends "1000\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0").  It then sends the
  1147. entire file.
  1148.  
  1149. ------------------------------
  1150.  
  1151. From: UUCP-G
  1152. Subject: What is the 'G' protocol?
  1153.  
  1154. The 'G' protocol is used by SVR4 UUCP.  It is identical to the 'g'
  1155. protocol, except that it is possible to modify the window and packet
  1156. sizes.  The SVR4 implementation of the 'g' protocol reportedly is
  1157. fixed at a packet size of 64 and a window size of 7.  Supposedly SVR4
  1158. chose to implement a new protocol using a new letter to avoid any
  1159. potential incompatibilities when using different packet or window
  1160. sizes.
  1161.  
  1162. Most implementations of the 'g' protocol that accept packets larger
  1163. than 64 bytes will also accept packets smaller than whatever they
  1164. requested in the INITB packet.  The SVR4 'G' implementation is an
  1165. exception; it will only accept packets of precisely the size it
  1166. requests in the INITB packet.
  1167.  
  1168. ------------------------------
  1169.  
  1170. From: UUCP-i
  1171. Subject: What is the 'i' protocol?
  1172.  
  1173. The 'i' protocol was written by Ian Lance Taylor (who also wrote this
  1174. FAQ).  It is used by Taylor UUCP version 1.04.
  1175.  
  1176. It is a sliding window packet protocol, like the 'g' protocol, but it
  1177. supports bidirectional transfers (i.e., file transfers in both
  1178. directions simultaneously).  It requires an eight bit clear
  1179. connection.  Several ideas for the protocol were taken from the paper
  1180. ``A High-Throughput Message Transport System'' by P. Lauder.  I don't
  1181. know where the paper was published, but the author's e-mail address is
  1182. piers@cs.su.oz.au.  The 'i' protocol does not adopt his main idea,
  1183. which is to dispense with windows entirely.  This is because some
  1184. links still do require flow control and, more importantly, because
  1185. using windows sets a limit to the amount of data which the protocol
  1186. must be able to resend upon request.  To reduce the costs of window
  1187. acknowledgements, the protocol uses a large window and only requires
  1188. an ack at the halfway point.
  1189.  
  1190. Each packet starts with a six byte header, optionally followed by data
  1191. bytes with a four byte checksum.  There are currently five defined
  1192. packet types (DATA, SYNC, ACK, NAK, SPOS, CLOSE) which are described
  1193. below.  Although any packet type may include data, any data provided
  1194. with an ACK, NAK or CLOSE packet is ignored.
  1195.  
  1196. Every DATA, SPOS and CLOSE packet has a sequence number.  The sequence
  1197. numbers are independent for each side.  The first packet sent by each
  1198. side is always number 1.  Each packet is numbered one greater than the
  1199. previous packet, modulo 32.
  1200.  
  1201. Every packet has a local channel number and a remote channel number.
  1202. For all packets at least one channel number is zero.  When a UUCP
  1203. command is sent to the remote system, it is assigned a non-zero local
  1204. channel number.  All packets associated with that UUCP command sent by
  1205. the local system are given the selected local channel number.  All
  1206. associated packets sent by the remote system are given the selected
  1207. number as the remote channel number.  This permits each UUCP command
  1208. to be uniquely identified by the channel number on the originating
  1209. system, and therefore each UUCP package can associate all file data
  1210. and UUCP command responses with the appropriate command.  This is a
  1211. requirement for bidirectional UUCP transfers.
  1212.  
  1213. The protocol maintains a single global file position, which starts at
  1214. 0.  For each incoming packet, any associated data is considered to
  1215. occur at the current file position, and the file position is
  1216. incremented by the amount of data contained.  The exception is a
  1217. packet of type SPOS, which is used to change the file position.
  1218. The reason for keeping track of the file position is described below.
  1219.  
  1220. The header is as follows:
  1221.  
  1222.     \007
  1223.     Every packet begins with ^G.
  1224.     (PACKET << 3) + LOCCHAN
  1225.     The five bit packet number combined with the three bit local
  1226.     channel number.  DATA, SPOS and CLOSE packets use the packet
  1227.     sequence number for the PACKET field.  NAK packet types use
  1228.     the PACKET field for the sequence number to be resent.  ACK
  1229.     and SYNC do not use the PACKET field, and generally leave it
  1230.     set to 0.  Packets which are not associated with a UUCP
  1231.     command from the local system use a local channel number of 0.
  1232.     (ACK << 3) + REMCHAN
  1233.     The five bit packet acknowledgement combined with the three
  1234.     bit remote channel number.  The packet acknowledgement is the
  1235.     number of the last packet successfully received; it is used by
  1236.     all packet types.  Packets which are not sent in response to a
  1237.     UUCP command from the remote system use a remote channel
  1238.     number of 0.
  1239.     (TYPE << 5) + (CALLER << 4) + LEN1
  1240.     The three bit packet type combined with the one bit packet
  1241.     direction combined with the upper four bits of the data
  1242.     length.  The packet direction bit is always 1 for packets sent
  1243.     by the calling UUCP, and 0 for packets sent by the called
  1244.     UUCP.  This prevents confusion caused by echoed packets.
  1245.     LEN2
  1246.     The lower eight bits of the data length.  The twelve bits of
  1247.     data length permit packets ranging in size from 0 to 4095
  1248.     bytes.
  1249.     CHECK
  1250.     The exclusive or of the second through fifth bytes of the
  1251.     header.  This provides an additional check that the header is
  1252.     valid.
  1253.  
  1254. If the data length is non-zero, the packet is immediately followed by
  1255. the specified number of data bytes.  The data bytes are followed by a
  1256. four byte CRC 32 checksum, with the most significant byte first.  The
  1257. CRC is calculated over the contents of the data field.
  1258.  
  1259. The defined packet types are as follows:
  1260.  
  1261.     0 (DATA)
  1262.     This is a plain data packet.
  1263.     1 (SYNC)
  1264.     SYNC packets are exchanged when the protocol is initialized,
  1265.     and are described further below.  SYNC packets do not carry
  1266.     sequence numbers (that is, the PACKET field is ignored).
  1267.     2 (ACK)
  1268.     This is an acknowledgement packet.  Since DATA packets also
  1269.     carry packet acknowledgements, ACK packets are only used when
  1270.     one side has no data to send.  ACK packets do not carry
  1271.     sequence numbers.
  1272.     3 (NAK)
  1273.     This is a negative acknowledgement.  This is sent when a
  1274.     packet is received incorrectly, and means that the packet
  1275.     number appearing in the PACKET field must be resent.  NAK
  1276.     packets do not carry sequence numbers (the PACKET field is
  1277.     already used).
  1278.     4 (SPOS)
  1279.     This packet changes the file position.  The packet contains
  1280.     four bytes of data holding the file position, most significant
  1281.     byte first.  The next packet received will be considered to be
  1282.     at the named file position.
  1283.     5 (CLOSE)
  1284.     When the protocol is shut down, each side sends a CLOSE
  1285.     packet.     This packet does have a sequence number, which could
  1286.     be used to ensure that all packets were correctly received
  1287.     (this is not needed by UUCP, however, which uses the higher
  1288.     level H command with an HY response).
  1289.  
  1290. When the protocol starts up, both systems send a SYNC packet.  The
  1291. SYNC packet includes at least three bytes of data.  The first two
  1292. bytes are the maximum packet size the remote system should send, most
  1293. significant byte first.  The third byte is the window size the remote
  1294. system should use.  The remote system may send packets of any size up
  1295. to the maximum.  If there is a fourth byte, it is the number of
  1296. channels the remote system may use (this must be between 1 and 7,
  1297. inclusive).  Additional data bytes may be defined in the future.
  1298.  
  1299. The window size is the number of packets that may be sent before a
  1300. packet is acknowledged.  There is no requirement that every packet be
  1301. acknowledged; any acknowledgement is considered to acknowledge all
  1302. packets through the number given.  In the current implementation, if
  1303. one side has no data to send, it sends an ACK when half the window is
  1304. received.
  1305.  
  1306. Note that the NAK packet corresponds to the unused 'g' protocol SRJ
  1307. packet type, rather than to the RJ packet type.  When a NAK is
  1308. received, only the named packet should be resent, not any subsequent
  1309. packets.
  1310.  
  1311. Note that if both sides have data to send, but a packet is lost, it is
  1312. perfectly reasonable for one side to continue sending packets, all of
  1313. which will acknowledge the last packet correctly received, while the
  1314. system whose packet was lost will be unable to send a new packet
  1315. because the send window will be full.  In this circumstance, neither
  1316. side will time out and one side of the communication will be
  1317. effectively shut down for a while.  Therefore, any system with
  1318. outstanding unacknowledged packets should arrange to time out and
  1319. resend a packet even if data is being received.
  1320.  
  1321. Commands are sent as a sequence of data packets with a non-zero local
  1322. channel number.  The last data packet for a command includes a
  1323. trailing null byte (normally a command will fit in a single data
  1324. packet).  Files are sent as a sequence of data packets ending with one
  1325. of length zero.
  1326.  
  1327. The channel numbers permit a more efficient implementation of the UUCP
  1328. file send command.  Rather than send the command and then wait for the
  1329. SY response before sending the file, the file data is sent beginning
  1330. immediately after the S command is sent.  If an SN response is
  1331. received, the file send is aborted, and a final data packet of length
  1332. zero is sent to indicate that the channel number may be reused.  If an
  1333. SY reponse with a file position indicator is received, the file send
  1334. adjusts to the file position; this is why the protocol maintains a
  1335. global file position.
  1336.  
  1337. Note that the use of channel numbers means that each UUCP system may
  1338. send commands and file data simultaneously.  Moreover, each UUCP
  1339. system may send multiple files at the same time, using the channel
  1340. number to disambiguate the data.  Sending a file before receiving an
  1341. acknowledgement for the previous file helps to eliminate the round
  1342. trip delays inherent in other UUCP protocols.
  1343.  
  1344. ------------------------------
  1345.  
  1346. From: UUCP-x
  1347. Subject: What is the 'x' protocol?
  1348.  
  1349. The 'x' protocol is used in Europe (and probably elsewhere) with
  1350. machines that contain an builtin X.25 card and can send eight bit data
  1351. transparently across X.25 circuits, without interference from the X.28
  1352. or X.29 layers.  The protocol sends packets of 512 bytes, and relies
  1353. on a write of zero bytes being read as zero bytes without stopping
  1354. communication.  It first appeared in the original System V UUCP
  1355. implementation.
  1356.  
  1357. ------------------------------
  1358.  
  1359. From: UUCP-d
  1360. Subject: What is the 'd' protocol?
  1361.  
  1362. This is apparently used for DataKit muxhost (not RS-232) connections.
  1363. No file size is sent.  When a file has been completely transferred, a
  1364. write of zero bytes is done; this must be read as zero bytes on the
  1365. other end.
  1366.  
  1367. ------------------------------
  1368.  
  1369. From: UUCP-h
  1370. Subject: What is the 'h' protocol?
  1371.  
  1372. This is apparently used in some places with HST modems.  It does no
  1373. error checking, and is not that different from the 't' protocol.  I
  1374. don't know the details.
  1375.  
  1376. ------------------------------
  1377.  
  1378. From: UUCP-v
  1379. Subject: What is the 'v' protocol?
  1380.  
  1381. The 'v' protocol is used by UUPC/extended, a DOS UUCP program.  It is
  1382. simply a version of the 'g' protocol which supports packets of any
  1383. size, and also supports sending packets of different sizes during the
  1384. same conversation.  There are many 'g' protocol implementations which
  1385. support both, but there are also many which do not.  Using 'v' ensures
  1386. that everything is supported.
  1387.  
  1388. ------------------------------
  1389.  
  1390. From: Thanks
  1391. Subject: Thanks
  1392.  
  1393. Besides the papers and information acknowledged at the top of this
  1394. article, the following people have contributed help, advice,
  1395. suggestions and information:
  1396.     Earle Ake 513-429-6500 <ake@Dayton.SAIC.COM>
  1397.     cambler@nike.calpoly.edu (Christopher J. Ambler)
  1398.     jhc@iscp.bellcore.com (Jonathan Clark)
  1399.     celit!billd@UCSD.EDU (Bill Davidson)
  1400.     "Drew Derbyshire" <ahd@kew.com>
  1401.     erik@pdnfido.fidonet.org
  1402.     Matthew Farwell <dylan@ibmpcug.co.uk>
  1403.     dgilbert@gamiga.guelphnet.dweomer.org (David Gilbert)
  1404.     kherron@ms.uky.edu (Kenneth Herron)
  1405.     Romain Kang <romain@pyramid.com>
  1406.     "Jonathan I. Kamens" <jik@GZA.COM>
  1407.     "David J. MacKenzie" <djm@eng.umd.edu>
  1408.     jum@helios.de (Jens-Uwe Mager)
  1409.     peter@xpoint.ruessel.sub.org (Peter Mandrella)
  1410.     david nugent <david@csource.oz.au>
  1411.     Stephen.Page@prg.oxford.ac.uk
  1412.     joey@tessi.UUCP (Joey Pruett)
  1413.     James Revell <revell@uunet.uu.net>
  1414.     Larry Rosenman <ler@lerami.lerctr.org>
  1415.     Rich Salz <rsalz@bbn.com>
  1416.     kls@ditka.Chicago.COM (Karl Swartz)
  1417.     Dima Volodin <dvv@hq.demos.su>
  1418.     jon@console.ais.org (Jon Zeeff)
  1419.     Eric Ziegast <ziegast@uunet.uu.net>
  1420.  
  1421. ------------------------------
  1422.  
  1423. End of UUCP Internals Frequently Asked Questions
  1424. ******************************
  1425. -- 
  1426. Ian Taylor | ian@airs.com | First to identify quote wins free e-mail message:
  1427. `` `Don't worry,' I say.  `I know what I'm doing.'  I stand up and consider
  1428.    my last statement, one of the most farfetched I have recently made.''
  1429.  
  1430.